package com.qfedu.entity;

import java.util.List;

public class Page {
    private int pageNum;
    private int pageSize;
    private List<GoodsEntity> goodslist;
    private int count;
    private int allpages;

    @Override
    public String toString() {
        return "Page{" +
                "pageNum=" + pageNum +
                ", pageSize=" + pageSize +
                ", goodslist=" + goodslist +
                ", count=" + count +
                ", allpages=" + allpages +
                '}';
    }

    public Page(int pageNum, int pageSize) {
        this.pageNum = pageNum;
        this.pageSize = pageSize;
    }

    public Page() {
    }

    public int getPageNum() {
        return pageNum;
    }

    public void setPageNum(int pageNum) {
        this.pageNum = pageNum;
    }

    public int getPageSize() {
        return pageSize;
    }

    public void setPageSize(int pageSize) {
        this.pageSize = pageSize;
    }

    public List<GoodsEntity> getGoodslist() {
        return goodslist;
    }

    public void setGoodslist(List<GoodsEntity> goodslist) {
        this.goodslist = goodslist;
    }

    public int getCount() {
        return count;
    }

    public void setCount(int count) {
        this.count = count;
        this.allpages=this.count%this.pageSize==0?this.count/this.pageSize:this.count/this.pageSize+1;
    }

    public int getAllpages() {
        return allpages;
    }

    public int getStartindex(){
        return (this.pageNum-1)*this.pageSize;
    }

}

